Skip to content

slot: preserve active tab when navigating between slots#708

Merged
barnabasbusa merged 1 commit into
masterfrom
bbusa/preserve-slot-tab-on-nav
May 21, 2026
Merged

slot: preserve active tab when navigating between slots#708
barnabasbusa merged 1 commit into
masterfrom
bbusa/preserve-slot-tab-on-nav

Conversation

@barnabasbusa
Copy link
Copy Markdown
Collaborator

@barnabasbusa barnabasbusa commented May 21, 2026

Summary

When viewing a slot with a non-Overview tab open (e.g. /slot/35#ptcVotes), clicking the prev/next chevron used to drop the hash and land on /slot/36 showing Overview. This made it tedious to compare the same tab across several slots.

The prev/next chevron anchors are tagged with a slot-nav-link class and the original path is stashed in data-slot-nav-base. A small JS helper rewrites their href to include location.hash on page load, on hashchange, and after a tab switch — so regular clicks, middle-clicks, and cmd-clicks all preserve the active tab.

A follow-up PR will address the brief Overview flash on uncached navigation (the page lands on the correct tab, but Bootstrap fades from Overview rather than starting on the target tab).

Test plan

  • On /slot/<N>#ptcVotes, click the right chevron → lands on /slot/<N+1>#ptcVotes with PTC Votes active.
  • On /slot/<N>#ptcVotes, click the left chevron → lands on /slot/<N-1>#ptcVotes with PTC Votes active.
  • Middle-click / cmd-click the chevrons → new tab opens with the hash preserved.
  • Click a tab → URL hash updates; click Overview → hash clears.
  • Navigate to a slot where the previously-open tab doesn't exist → falls back to Overview.

Carry the URL hash forward on the prev/next chevrons so e.g.
/slot/35#ptcVotes -> next chevron -> /slot/36#ptcVotes lands on the
same tab. The chevron href is rewritten on page load, hashchange, and
tab switches, so regular, middle, and cmd+click all preserve the tab.
@barnabasbusa barnabasbusa merged commit 124f662 into master May 21, 2026
5 checks passed
@barnabasbusa barnabasbusa deleted the bbusa/preserve-slot-tab-on-nav branch May 21, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants